from building import *

cwd  = GetCurrentDir()

list = os.listdir(cwd)

src = []
src += ["driver/audio/ring_buffer_dma_write.c"]
src += ["driver/codec/driver_codec_es8374.c"]
src += ["driver/common/dd.c"]
src += ["driver/common/drv_model.c"]
src += ["driver/dma/dma.c"]
src += ["driver/entry/arch_main.c"]
src += ["driver/fft/fft.c"]
src += ["driver/flash/flash.c"]
src += ["driver/general_dma/general_dma.c"]
src += ["driver/gpio/gpio.c"]
src += ["driver/i2s/i2s.c"]
src += ["driver/icu/icu.c"]
src += ["driver/intc/intc.c"]
src += ["driver/irda/irda.c"]
src += ["driver/macphy_bypass/mac_phy_bypass.c"]
src += ["driver/phy/phy_trident.c"]
src += ["driver/pwm/pwm.c"]
src += ["driver/pwm/mcu_ps_timer.c"]
src += ["driver/pwm/bk_timer.c"]
src += ["driver/rw_pub/rw_platf_pub.c"]
src += ["driver/saradc/saradc.c"]
src += ["driver/sdcard/sdcard.c"]
src += ["driver/sdcard/sdio_driver.c"]
src += ["driver/sdio/sdio.c"]
src += ["driver/sdio/sdma.c"]
src += ["driver/sdio/sutil.c"]
src += ["driver/spi/spi.c"]
src += ["driver/spi/spi_master.c"]
src += ["driver/spi/spi_psram.c"]
src += ["driver/spi/spi_flash.c"]
src += ["driver/spi/spi_slave.c"]
src += ["driver/spidma/spidma.c"]
src += ["driver/jpeg/jpeg_encoder.c"]
src += ["driver/i2c/i2c1.c"]
src += ["driver/i2c/i2c2.c"]
src += ["driver/sys_ctrl/sys_ctrl.c"]
src += ["driver/uart/Retarget.c"]
src += ["driver/uart/uart.c"]
src += ["driver/wdt/wdt.c"]
src += ["driver/usb/usb.c"]
src += ["driver/security/security.c"]
src += ["driver/security/hal_aes.c"]
src += ["driver/driver.c"]
src += ["driver/qspi/qspi.c"]

src += ["rttos/source/rtos_pub.c"]
src += ["rttos/source/bk_rtos_pub.c"]
src += ["rttos/source/port.c"]
src += ["rttos/source/port_asm.S"]
src += ["rttos/source/bk_rtos_task.c"]
src += ["rttos/mem_arch.c"]
src += ["rttos/os_clock.c"]
src += ["rttos/str_arch.c"]
src += ["rttos/target_util.c"]
src += ["rttos/ate/rtt_ate_app.c"]    

src += ["func/saradc_intf/saradc_intf.c"]
src += ["app/config/param_config.c"]
src += ["app/app.c"]
src += ["app/standalone-ap/sa_ap.c"]
src += ["app/standalone-station/sa_station.c"]
src += ["app/led/app_led.c"]
#src += ["app/app_demo/app_demo_softap.c"]
#src += ["app/app_demo/app_demo_tcp.c"]
#src += ["app/app_demo/app_demo_udp.c"]
#src += ["app/app_demo/app_video_intf.c"]
src += ["demo/ieee802_11_demo.c"]
#src += ["demo/os_demo.c"]

src += ["func/func.c"]
src += ["func/power_save/power_save.c"]
src += ["func/power_save/mcu_ps.c"]
src += ["func/power_save/manual_ps.c"]
src += ["func/rwnx_intf/rw_msg_rx.c"]
src += ["func/net_param_intf/net_param.c"]
src += ["func/misc/pseudo_random.c"]
src += ["func/joint_up/role_launch.c"]
src += ["func/bk7011_cal/bk7231_cal.c"]
src += ["func/bk7011_cal/bk7231U_cal.c"]
src += ["func/bk7011_cal/bk7221U_cal.c"]
src += ["func/bk7011_cal/manual_cal_bk7231.c"]
src += ["func/bk7011_cal/manual_cal_bk7231U.c"]
src += ["func/temp_detect/temp_detect.c"]
src += ["func/rwnx_intf/rw_ieee80211.c"]
src += ["func/rwnx_intf/rw_msdu.c"]
src += ["func/rwnx_intf/rw_msg_tx.c"]
src += ["func/rf_test/tx_evm.c"]
src += ["func/rf_test/rx_sensitivity.c"]
src += ["func/uart_debug/cmd_rx_sensitivity.c"]
src += ["func/uart_debug/cmd_evm.c"]
src += ["func/uart_debug/command_line.c"]         
src += ["func/user_driver/BkDriverFlash.c"]
src += ["func/user_driver/BkDriverPwm.c"]
src += ["func/user_driver/BkDriverQspi.c"]
src += ["func/wlan_ui/wlan_ui.c"]
src += ["func/usb_plug/usb_plug.c"]
src += ["func/hostapd_intf/hostapd_intf.c"]

src += ["func/hostapd-2.5/bk_patch/ddrv.c"]
src += ["func/hostapd-2.5/bk_patch/signal.c"]
src += ["func/hostapd-2.5/bk_patch/sk_intf.c"]
src += ["func/hostapd-2.5/bk_patch/fake_socket.c"]
src += ["func/hostapd-2.5/hostapd/main_none.c"]
src += ["func/hostapd-2.5/src/ap/ap_config.c"]
src += ["func/hostapd-2.5/src/ap/ap_drv_ops.c"]
src += ["func/hostapd-2.5/src/ap/ap_list.c"]
src += ["func/hostapd-2.5/src/ap/ap_mlme.c"]
src += ["func/hostapd-2.5/src/ap/authsrv.c"]
src += ["func/hostapd-2.5/src/ap/beacon.c"]
src += ["func/hostapd-2.5/src/ap/bss_load.c"]
src += ["func/hostapd-2.5/src/ap/dfs.c"]
src += ["func/hostapd-2.5/src/ap/drv_callbacks.c"]
src += ["func/hostapd-2.5/src/ap/eap_user_db.c"]
src += ["func/hostapd-2.5/src/ap/hostapd.c"]
src += ["func/hostapd-2.5/src/ap/hw_features.c"]
src += ["func/hostapd-2.5/src/ap/ieee802_11_auth.c"]
src += ["func/hostapd-2.5/src/ap/ieee802_11.c"]
src += ["func/hostapd-2.5/src/ap/ieee802_11_ht.c"]
src += ["func/hostapd-2.5/src/ap/ieee802_11_shared.c"]
src += ["func/hostapd-2.5/src/ap/ieee802_1x.c"]
src += ["func/hostapd-2.5/src/ap/pmksa_cache_auth.c"]
src += ["func/hostapd-2.5/src/ap/sta_info.c"]
src += ["func/hostapd-2.5/src/ap/tkip_countermeasures.c"]
src += ["func/hostapd-2.5/src/ap/utils.c"]
src += ["func/hostapd-2.5/src/ap/wmm.c"]
src += ["func/hostapd-2.5/src/ap/wpa_auth.c"]
src += ["func/hostapd-2.5/src/ap/wpa_auth_glue.c"]
src += ["func/hostapd-2.5/src/ap/wpa_auth_ie.c"]
src += ["func/hostapd-2.5/src/common/hw_features_common.c"]
src += ["func/hostapd-2.5/src/common/ieee802_11_common.c"]
src += ["func/hostapd-2.5/src/common/wpa_common.c"]
src += ["func/hostapd-2.5/src/crypto/aes-internal.c"]
src += ["func/hostapd-2.5/src/crypto/aes-internal-dec.c"]
src += ["func/hostapd-2.5/src/crypto/aes-internal-enc.c"]
src += ["func/hostapd-2.5/src/crypto/aes-unwrap.c"]
src += ["func/hostapd-2.5/src/crypto/aes-wrap.c"]
src += ["func/hostapd-2.5/src/crypto/md5.c"]
src += ["func/hostapd-2.5/src/crypto/md5-internal.c"]
src += ["func/hostapd-2.5/src/crypto/rc4.c"]
src += ["func/hostapd-2.5/src/crypto/sha1.c"]
src += ["func/hostapd-2.5/src/crypto/sha1-internal.c"]
src += ["func/hostapd-2.5/src/crypto/sha1-pbkdf2.c"]
src += ["func/hostapd-2.5/src/crypto/sha1-prf.c"]
src += ["func/hostapd-2.5/src/crypto/tls_none.c"]
src += ["func/hostapd-2.5/src/drivers/driver_beken.c"]
src += ["func/hostapd-2.5/src/drivers/driver_common.c"]
src += ["func/hostapd-2.5/src/drivers/drivers.c"]
src += ["func/hostapd-2.5/src/eap_common/eap_common.c"]
src += ["func/hostapd-2.5/src/eapol_auth/eapol_auth_sm.c"]
src += ["func/hostapd-2.5/src/eap_server/eap_server.c"]
src += ["func/hostapd-2.5/src/eap_server/eap_server_methods.c"]
src += ["func/hostapd-2.5/src/l2_packet/l2_packet_none.c"]
src += ["func/hostapd-2.5/src/rsn_supp/preauth.c"]
src += ["func/hostapd-2.5/src/rsn_supp/wpa.c"]
src += ["func/hostapd-2.5/src/rsn_supp/wpa_ie.c"]
src += ["func/hostapd-2.5/src/utils/common.c"]
src += ["func/hostapd-2.5/src/utils/eloop.c"]
src += ["func/hostapd-2.5/src/utils/os_none.c"]
src += ["func/hostapd-2.5/src/utils/wpabuf.c"]
src += ["func/hostapd-2.5/wpa_supplicant/ap.c"]
src += ["func/hostapd-2.5/wpa_supplicant/blacklist.c"]
src += ["func/hostapd-2.5/wpa_supplicant/bss.c"]
src += ["func/hostapd-2.5/wpa_supplicant/config.c"]
src += ["func/hostapd-2.5/wpa_supplicant/config_none.c"]
src += ["func/hostapd-2.5/wpa_supplicant/eap_register.c"]
src += ["func/hostapd-2.5/wpa_supplicant/events.c"]
src += ["func/hostapd-2.5/wpa_supplicant/main_supplicant.c"]
src += ["func/hostapd-2.5/wpa_supplicant/notify.c"]
src += ["func/hostapd-2.5/wpa_supplicant/wmm_ac.c"]
src += ["func/hostapd-2.5/wpa_supplicant/wpa_scan.c"]
src += ["func/hostapd-2.5/wpa_supplicant/wpas_glue.c"]
src += ["func/hostapd-2.5/wpa_supplicant/wpa_supplicant.c"]
src += ["func/spidma_intf/spidma_intf.c"]
src += ["func/camera_intf/camera_intf.c"]
src += ["func/video_transfer/video_transfer.c"]
src += ["func/video_transfer/video_buffer.c"]
src += ["func/voice_transfer/voice_transfer.c"]
src += ["func/lwip_intf/dhcpd/dhcp-server.c"]
src += ["func/lwip_intf/dhcpd/dhcp-server-main.c"]
src += ["func/vad/vad.c"]
src += ["func/vad/vad_core.c"]
src += ["func/vad/wb_vad.c"]

path = []
path += [cwd + '/app']
path += [cwd + '/app/config']
path += [cwd + '/app/standalone-ap']
path += [cwd + '/app/standalone-station']
path += [cwd + '/app/net_work']
path += [cwd + '/app/led']
path += [cwd + '/app/app_demo']
path += [cwd + '/common']
path += [cwd + '/demo']
path += [cwd + '/driver/audio']
path += [cwd + '/driver/codec']
path += [cwd + '/driver/common']
path += [cwd + '/driver/common/reg']
path += [cwd + '/driver/dma']
path += [cwd + '/driver/entry'] 
path += [cwd + '/driver/fft']
path += [cwd + '/driver/flash']
path += [cwd + '/driver/general_dma']
path += [cwd + '/driver/gpio']
path += [cwd + '/driver/i2s']
path += [cwd + '/driver/icu']
path += [cwd + '/driver/include']
path += [cwd + '/driver/intc']
path += [cwd + '/driver/irda']
path += [cwd + '/driver/macphy_bypass']
path += [cwd + '/driver/phy']
path += [cwd + '/driver/pwm']
path += [cwd + '/driver/qspi']
path += [cwd + '/driver/rw_pub']
path += [cwd + '/driver/rc_beken']
path += [cwd + '/driver/saradc']
path += [cwd + '/driver/sdcard']
path += [cwd + '/driver/sdio']
path += [cwd + '/driver/spi']
path += [cwd + '/driver/spidma']
path += [cwd + '/driver/sys_ctrl']
path += [cwd + '/driver/uart']
path += [cwd + '/driver/wdt']
path += [cwd + '/driver/jpeg']
path += [cwd + '/driver/i2c']
path += [cwd + '/driver/security']
path += [cwd + '/rttos/include']
path += [cwd + '/rttos/source']
path += [cwd + '/rttos/ate']
path += [cwd + '/ip/common']
path += [cwd + '/ip/ke']
path += [cwd + '/ip/mac']
path += [cwd + '/ip/lmac/src/hal']
path += [cwd + '/ip/lmac/src/mm']
path += [cwd + '/ip/lmac/src/ps']
path += [cwd + '/ip/lmac/src/rd']
path += [cwd + '/ip/lmac/src/rx']
path += [cwd + '/ip/lmac/src/scan']
path += [cwd + '/ip/lmac/src/sta']
path += [cwd + '/ip/lmac/src/tx']
path += [cwd + '/ip/lmac/src/vif']
path += [cwd + '/ip/lmac/src/rx/rxl']
path += [cwd + '/ip/lmac/src/tx/txl']
path += [cwd + '/ip/lmac/src/rwnx']
path += [cwd + '/ip/lmac/src/p2p']
path += [cwd + '/ip/lmac/src/chan']
path += [cwd + '/ip/lmac/src/td']
path += [cwd + '/ip/lmac/src/tpc']
path += [cwd + '/ip/lmac/src/tdls']
path += [cwd + '/ip/umac/src/bam']
path += [cwd + '/ip/umac/src/llc']
path += [cwd + '/ip/umac/src/me']
path += [cwd + '/ip/umac/src/rxu']
path += [cwd + '/ip/umac/src/scanu']
path += [cwd + '/ip/umac/src/sm']
path += [cwd + '/ip/umac/src/txu']
path += [cwd + '/ip/umac/src/apm']
path += [cwd + '/ip/umac/src/rc']
path += [cwd + '/ip/umac/src/mesh']
path += [cwd + '/func']
path += [cwd + '/func/include']
path += [cwd + '/func/rf_test']
path += [cwd + '/func/joint_up']
path += [cwd + '/func/temp_detect']
path += [cwd + '/func/user_driver']
path += [cwd + '/func/power_save']
path += [cwd + '/func/ethernet_intf']
path += [cwd + '/func/uart_debug']
path += [cwd + '/func/ip/umac/src/apm']
path += [cwd + '/func/rwnx_intf']
path += [cwd + '/func/hostapd-2.5/src']
path += [cwd + '/func/hostapd-2.5/bk_patch']
path += [cwd + '/func/hostapd-2.5/hostapd']
path += [cwd + '/func/hostapd-2.5/src/utils']
path += [cwd + '/func/hostapd-2.5/src/drivers']
path += [cwd + '/func/hostapd-2.5/src/common']
path += [cwd + '/func/saradc_intf']
path += [cwd + '/func/vad']
path += [cwd + '/func/spidma_intf']
path += [cwd + '/func/camera_intf']
path += [cwd + '/func/video_transfer']
path += [cwd + '/func/voice_transfer']
path += [cwd + '/func/lwip_intf\dhcpd']
libs = []

libpath = []

objs = []

cppdefines = ['CFG_SUPPORT_RTT']

group = DefineGroup('beken_sdk', src, depend = [''], CPPPATH = path, CPPDEFINES = cppdefines, LIBS = libs, LIBPATH = libpath)

for d in list:
    path = os.path.join(cwd, d)
    if os.path.isfile(os.path.join(path, 'SConscript')):
        objs = objs + SConscript(os.path.join(d, 'SConscript'))
objs = objs + group
Return('objs')
